<?php include "inc/conn.php";?><?php include "inc/pubs.php";?>
<?php include "inc/safe.php";?><?php include "inc/sqls.php";?>
<?php
$pagesize = "10";//修改每页个数
$page = trim($_GET["page"]);
$th = $_COOKIE['name'];
$dn = $_COOKIE['pass'];
//判断是否记忆登陆
If($dn == md5($th.$ao)){
}else{
webalert("请先登陆(I1)!","login.php?tt=".$tts);
}
$db=ConnectMysqli::getIntance($conn);
?><!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0" />
<meta name="apple-esle-web-app-capable" content="yes" />
<title>我的预约</title>
<meta name="author" content="yujianyue, admin@ewuyi.net">
<meta name="copyright" content="www.12391.net">
<link href="inc/css/style.css<?php echo $dp; ?>" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="inc/js/js.js<?php echo $dp; ?>"></script>
<!--- <?php echo $ad; ?> --->
</head>
<body onLoad="inst();">
<div class="html">
<div class="divs" id="divs">
<div id="head" class="head" >
<div class="bs">我的预约</div>
<div class="back" id="le">
<ul id="menu" class="center">
<li class="menu"><a href="#" class="btn">更多</a>
<dl class="list" id="list">
<li><a href="index.php?t=<?php echo $tts; ?>" class="d">我的预约</a></li>
<li><a href="bang.php?t=<?php echo $tts; ?>" class="d">我要预约</a></li>
<?php
if(file_exists($ld)){
$xi = Trim(fi($ld, 2));
if($xi == md5($th)){
?>
<li><a href="list.php?t=<?php echo $tts; ?>" class="d">所有预约</a></li>
<li><a href="down.php?t=<?php echo $tts; ?>" class="d">导出预约</a></li>
<?php
}
}
?>
</dl></li>
</ul>
</div>
</div>
<div class="main" id="main">
<?php
$ename = $cuser;
$urls= "";
$db=ConnectMysqli::getIntance($conn);
$sql="SELECT COUNT(*)  FROM `{$no}` where `{$lr}` = '{$th}'";
$list=$db->getRow($sql);
$lf=$list['COUNT(*)'];
$pagecount = bcdiv($lf+$pagesize-1,$pagesize,0); //算出总页数
if(!isset($page)) $page = 1; //如果没有指定显示页码，缺省为显示第一页
if(!is_numeric($page)) $page = 1;
if($page<1) $page = 1; //如果页码比1小，则显示第一页
if($page>$pagecount) $page = $pagecount; //如果页码比总页数大，则显示最后一页
$p = $page * $pagesize + 1 - $pagesize -1;
if($p<0) $p = 0; //按理说$page肯定大于1这行不用加
$sql="SELECT *  FROM `{$no}` WHERE  `{$lr}` = '{$th}'";
$sql.=" ORDER BY `{$ow}` DESC "; //如需定义删行首双斜杠并修改字段ID为自定义字段
$sql.=" limit $p, $pagesize";
$list=$db->getAll($sql);
//echo json_encode($list);
echo "<h1>&nbsp;</h1>\r\n";
echo "<div style=\"margin:0 auto;overflow-x:auto;width:98%;max-width:1188px;\">";
echo "\r\n<!--startprint-->\r\n<h1>共{$lf}预约记录</h1>\r\n";
echo "<table cellspacing=\"0\" class=\"table\"> \r\n";
$ii=0;
if($p<0) $p = 0; //如果
foreach ($list as $lina ) {
$ii++;
if($ii=="1"){
echo "\r\n<thead>\r\n<tr class=\"tt\">\r\n";
$li=0;
foreach ($lina as $il => $de ) {
if(stristr($cd,"-{$il}-")){
echo "<!--隐藏列-->\r\n";
}else{
$li++;
echo "<td><nobr>$il</nobr></td>\r\n";
}
}
echo "</tr>\r\n</thead>\r\n";
echo "\r\n<tbody>\r\n";
}
echo "\r\n<tr>\r\n";
$al = $lina[$rf];$ta = $lina[$tv];
foreach ($lina as $il => $de ) {
$dd="yes";
if(stristr($cd,"-{$il}-")){
$dd="hid";
}elseif($il=="isyue"){
switch ($de) {
case "-1":$de = "黑名单";break;
case "0":$de = "待预约";break;
case "1":$de = "已预约";break;
case "2":$de = "已领取";break;
default:$de = "未知($de)";break;
}
$de = "<td data-label=\"{$il}：\">$de</td>";
}elseif($il=="领取时间"){
if($lina['isyue']<2){
$de = "<td data-label=\"{$il}：\">-</td>";
}else{
$de = "<td data-label=\"{$il}：\">$de</td>";
}
}elseif($il==$ow){
//含端口转发
$cu = $_SERVER["SERVER_PORT"];
if($cu=="80" || $cu==""){
$se = "";
$wn = "http://".$me;
}elseif($cu=="443"){
$se = "";
$wn = "https://".$me;
}else{
$se = ":".$cu;
$wn = "http://".$me;
}
$request_dir = $_SERVER['PHP_SELF'];
$request_dir = str_replace("index.php","it.php",$request_dir);
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';//参数
$tx = $wn.$se.$request_dir."?d={$de}";
$de = "<img src=\"inc/Qr.php?data={$tx}\" alt=\"{$de}\">";
$de = "<td rowspan=\"2\" data-label=\"{$il}：\">$de</td>";
}elseif($il==$dr){
if($lina['isyue']<1 ){
$de = "<td data-label=\"{$il}：\">-</td>";
}else{
$de = "<td data-label=\"{$il}：\">$de</td>";
}
}else{
if(strlen(Trim($de))<1){
$de = "<td data-label=\"{$il}：\">-</td>";
}else{
$de = "<td data-label=\"{$il}：\">$de</td>";
}
}
if($dd=="hid"){
echo "<!--hidden 1 lie-->\r\n";
}else{
echo "$de\r\n";
}
}
echo "</tr>\r\n";
$ni = $lina[$rf];
$pk = $lina[$ur];
$us = $lina[$tv];
$wf = " WHERE `预约批次` = '{$ni}' AND `店铺名称` = '{$us}' ";
$yl="SELECT *  FROM `{$no}_shop` {$wf}";
$yl.=" limit 0, 1";
$wx=$db->getAll($yl);
//echo "<br>$yl<br>".json_encode($wx);
$rv = $wx[0]["领取日期"]." ".$wx[0]["营业时间"];
$is = $wx[0]["店铺地址"]; $ftell = $wx[0]["联系电话"];
$py = $wx[0]["每份数量"]; $xn = $wx[0]["每份付费"];
$li1 = $li-1;
echo "<tr>\r\n";
echo "<td data-label=\"领取信息：\" colspan=\"{$li1}\" class=\"l\" valign=\"top\">\r\n";
echo "<b>恭喜你预约成功:</b>{$py}(<strong>$xn</strong>)。<br>\r\n";
echo "<b>领取方式:</b>凭{$ur}<strong>$pk 原件</strong>于<strong>$rv</strong>到{$tv}<strong>$us</strong>(<strong>$is</strong>)领取,逾期无效。 \r\n";
echo "；<b>费用支付</b>当面结清；有问题请致电<strong>{$ftell}</strong>。";
echo "</td>\r\n";
echo "</tr>\r\n";
}
if($ii<1){
echo "<tr>\r\n";
echo "<td data-label=\"查询提示：\" colspan=\"{$li}\">暂无预约记录</td>\r\n";
echo "</tr>\r\n";
echo "</tbody>\r\n";
echo "</table>\r\n";
}else{
echo "</tbody>\r\n";
echo "</table>\r\n";
if($pagecount>1){ //页码比0大，表示有数据
echo "<br><table cellspacing=\"0\" class=\"table\"> \r\n";
echo "<tbody> <!-- colspan=\"{$li}\" -->\r\n<tr><td data-label=\"页码：\" >";
if($page>1){
echo '<a href="?page=1' . $urls . '">首页</a> ';
echo '<a href="?page='. ($page-1) . '' . $urls . '">前页</a> ';
	}
if($page<$pagecount){
echo '<a href="?page='. ($page+1) . '' . $urls . '">后页</a> ';
echo '<a href="?page=' . $pagecount . '' . $urls . '">尾页</a> ';
	}
echo '页次<b>' . $page . '</b>/<b>' . $pagecount . '</b> ';
echo '<b>' . $pagesize . '</b>条/页 ';
echo "共<b>$lf</b>条 计发<b>$im</b>元 </td><tr>";
echo "</tbody> \r\n</table>\r\n";
}
}
echo "\r\n<!--endprint-->\r\n</div>\r\n";
?>
</div>
<?php include "inc/foot.php";?>
</div>
</div>
</body>
</html>